"""
Tensor的组合与拼接
- torch.cat(seq, dim=0, out=None) 按照已经存储的维度进行拼接
- torch.stack(seq, dim=0, out=None) 按照新的维度进行拼接
- torch.gather(input, dim, index, out=None) 在指定维度上按照索引赋值输出tensor

"""
import torch

# a = torch.zeros((2, 4))
# b = torch.ones((2, 4))
# out = torch.cat((a, b), dim=0)
# print(out)
# out = torch.cat((a, b), dim=1)
# print(out)

a = torch.linspace(1, 6, 6).view(2, 3)
b = torch.linspace(7, 12, 6).view(2, 3)
print(a)
print(b)
out = torch.stack((a, b), dim=0)
print(out)
print(out.shape)

